/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-05-04 09:50:21
 * @LastEditTime : 2023-08-18 16:20:54
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\EngineeringOrganization.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList, BuiltInData } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton } from '../Common/options'
import { EnumComments, GetAllmanagedOrganizations, getCompanyList } from '../Common/Conversion'

export const EngineeringOrganization = async ({ url, OptionsEvent, ClientData, Permission, actionRef }) => {
    let data = {
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`get${url}`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        options: [<AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="新增" />],
        columns: [
            commonTableList.uuid,
            // { ...commonTableList.tableName, rules: true },
            // { ...commonTableList.fullName, rules: true },
            {
                ...commonTableList.organizationUuid,
                valueEnum: await GetAllmanagedOrganizations(),
                rules: true,
                ellipsis: false,
            },
            {
                dataIndex: 'projectManagementTeam',
                title: '项目经理部',
                valueType: 'input',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'projectManager',
                title: '项目经理',
                valueType: 'input',
                ellipsis: true,
                width: 200,
            },
            {
                dataIndex: 'owner',
                title: '业主名称',
                valueType: 'input',
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'constructionSite',
                title: '施工地点',
                valueType: 'input',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'numberLength',
                title: '施工桩号及长度',
                valueType: 'input',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'qualifiedUnit',
                title: '资质单位',
                valueType: 'input',
                ellipsis: true,
                width: 200,
            },
            {
                dataIndex: 'cooperationType',
                title: '项目性质',
                valueType: 'select',
                ellipsis: true,
                width: 100,
                valueEnum: await EnumComments('cooperationType'),
            },
            {
                dataIndex: 'engineeringScale',
                title: '工程规模',
                valueType: 'select',
                ellipsis: true,
                hideInSearch: true,
                width: 100,
                valueEnum: await EnumComments('engineeringScale'),
            },
            {
                dataIndex: 'winningBidderUuid',
                title: '中标单位',
                valueType: 'select',
                valueEnum: await getCompanyList(),
                ellipsis: true,
                width: 200,
            },
            {
                dataIndex: 'construction',
                title: '施工单位',
                valueType: 'input',
                ellipsis: true,
                width: 200,
                hideInAdded: true,
                hideInModify: true,
            },
            {
                dataIndex: 'contractStartDate',
                title: '合同开始时间',
                valueType: 'Date',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'contractEndDate',
                title: '合同结束时间',
                valueType: 'Date',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'workStartDate',
                title: '开工日期',
                valueType: 'Date',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'acceptanceDate',
                title: '中标日期',
                valueType: 'Date',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'workEndDate',
                title: '竣工日期',
                valueType: 'Date',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'contractAmount',
                title: '合同金额',
                valueType: 'input',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'acceptanceAmount',
                title: '中标金额',
                valueType: 'input',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'provisionalAmount',
                title: '暂定金金额',
                valueType: 'input',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'chaptersAmount',
                title: '百章合计金额',
                valueType: 'input',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'isInsideEnterprise',
                title: '是否为工建内',
                valueType: 'select',
                ellipsis: true,
                width: 200,
                valueEnum: BuiltInData.isYes,
                rules: true,
                hideInSearch: true,
            },
            {
                dataIndex: 'isTendering',
                title: '是否招标',
                valueType: 'select',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
                valueEnum: BuiltInData.isYes,
            },
            {
                dataIndex: 'engineeringStatus',
                title: '工程状态',
                valueType: 'select',
                ellipsis: true,
                width: 100,
                valueEnum: await EnumComments('engineeringStatus'),
            },
            {
                dataIndex: 'isContractSigned',
                title: '是否签合同',
                valueType: 'select',
                ellipsis: true,
                hideInSearch: true,
                width: 200,
                valueEnum: BuiltInData.isYes,
            },
            {
                dataIndex: 'embodyType',
                title: '收录类型',
                valueType: 'select',
                ellipsis: true,
                width: 200,
                valueEnum: await EnumComments('embodyType'),
                rules: true,
            },
            {
                dataIndex: 'qualificationType',
                title: '中标资质类型',
                valueType: 'select',
                ellipsis: true,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                width: 200,
                valueEnum: await EnumComments('qualificationType'),
                rules: true,
            },
            {
                dataIndex: 'address',
                title: '地市',
                valueType: 'select',
                valueEnum: ClientData.dictionary['ff17b144-6a23-4b0d-84a5-9aab9f52225b'],
                ellipsis: true,
                width: 200,
            },
            { ...commonTableList.BeginDate, title: '中标金额开始', dataIndex: 'BeginAmount' },
            { ...commonTableList.EndDate, title: '中标金额结束', dataIndex: 'EndAmount' },
            { ...commonTableList.BeginDate, title: '合同开始-从' },
            { ...commonTableList.EndDate, title: '到-合同开始' },
            { ...commonTableList.BeginDate, title: '合同结束-从', dataIndex: 'BeginStatDate' },
            { ...commonTableList.EndDate, title: '到-合同结束', dataIndex: 'EndStatDate' },
            {
                dataIndex: 'engineeringType',
                title: '工程类型',
                valueType: 'select',
                valueEnum: ClientData.dictionary['3b863e8d-4476-44e2-b487-96d0a948a080'],
                ellipsis: true,
                width: 200,
            },
            {
                dataIndex: 'isEnabled',
                title: '工地是否启用',
                valueType: 'select',
                ellipsis: true,
                width: 200,
                valueEnum: BuiltInData.IsEnabled,
            },
            {
                dataIndex: 'isEnabledCost',
                title: '成本是否启用',
                valueType: 'select',
                ellipsis: true,
                width: 200,
                valueEnum: BuiltInData.IsEnabled,
            },
            {
                dataIndex: 'isEnabledFinance',
                title: '财务是否启用',
                valueType: 'select',
                ellipsis: true,
                width: 200,
                valueEnum: BuiltInData.IsEnabled,
            },
            { ...commonTableList.sortId, rules: true },
            commonTableList.remark,
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 160,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <ModDataButton OptionsEvent={OptionsEvent} key="modify" title="修改" data={record} />,
                        <DelDataButton
                            OptionsEvent={OptionsEvent}
                            key="del"
                            title="删除"
                            url={url}
                            uuid={record.uuid}
                        />,
                    ]
                },
            },
        ],
    }

    return data
}
